Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Adding TRT options/task #435

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

WIP: Adding TRT options/task #435

wants to merge 5 commits into from

Conversation

pranavm-nvidia
Copy link
Collaborator

No description provided.

Comment on lines +38 to +50
// TODO (pranavm): Figure out a better way to reuse TRT translation options -
// maybe move to options providers?
struct TensorRTOptions
: public mlirtrt::compiler::OptionsProvider<TensorRTOptions> {
mlir::tensorrt::TensorRTTranslationOptions options;

void addToOptions(mlir::OptionsContext &context) {
options.addToOptions(context);
}
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move TensorRTTranslationOptions to make them an options provider if that makes sense to do.

Comment on lines +56 to +60
// TODO (pranavm): Check if this needs to be conditional - the TRT passes
// above are not.
#ifdef MLIR_TRT_TARGET_TENSORRT
mlirtrt::compiler::registerTensorRTToExecutableTask();
#endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what exactly needs to be guarded. In a lot of places we guard TRT things with MLIR_TRT_TARGET_TENSORRT but that doesn't seem to be the case for the TRT passes registered above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TensorRT dialect and MLIR passes are always built. It doesn't depend on actually having TensorRT binaries or headers to build against (or at least, that was the idea, we haven't been enforcing it). The MLIR_TRT_TARGET_TENSORRT is basically a guard for anything that relies on having actual TRT headers or libraries to link against, for example the translation from MLIR to TensorRT, hence the TARGET_TENSORRT in the name.

Comment on lines +23 to +24
# TODO (pranavm): TensorRTToExecutable should probably be a separate library
TensorRTToExecutable.cpp
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that there's an open TODO for TensorRTExtension.cpp I'm wondering if this is more complicated than it seems.

Comment on lines 30 to 42
TensorRTToExecutableOptions::TensorRTToExecutableOptions(
TaskExtensionRegistry extensions) {
// TODO (pranavm): Do we need to support extensions?
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to require extensions for all options types or if we need to handle both cases in the options registry. If it's the former, then I can just assert that the extensions are empty here (or maybe even just add support?). If it's the latter, we could have a setExtensions method so it becomes optional instead of having it part of the constructor.

@@ -127,6 +127,18 @@ struct DeviceOptions : public OptionsProvider<DeviceOptions> {
llvm::Error finalizeImpl();
};

struct EntrypointOptions : public OptionsProvider<EntrypointOptions> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be called "common compilation options" or similar. Really 'entrypoint' shouldn't be required at all and should be eliminated from whatever passes require this (not required for this MR).

#include "mlir-tensorrt/Compiler/OptionsProviders.h"
#include "mlir/Pass/PassManager.h"

using namespace mlirtrt::compiler;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never ever put using namespace ... into a header file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is from a bunch of copy-pasting to get the scaffolding done. I'll clean everything up once I have something working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants